package com.xjgc.msibase.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjgc.msibase.entity.MsiServer;
import com.xjgc.msibase.entity.MsiServerRecordInfo;
import com.xjgc.msibase.mapper.MsiServerMapper;
import com.xjgc.msibase.mapper.MsiServerRecordInfoMapper;
import com.xjgc.msibase.service.IMsiServerRecordInfoService;
import com.xjgc.msibase.service.IMsiServerRecordService;
import com.xjgc.msibase.service.IMsiServerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 中间库服务
 *
 * @Description:
 * @Author: 小逗号
 * @Date: 2023-11-02
 * @Version: V1.0
 */
@Slf4j
@Service
public class MsiServerRecordInfoServiceImpl
        extends ServiceImpl<MsiServerRecordInfoMapper, MsiServerRecordInfo>
        implements IMsiServerRecordInfoService {


    @Override
    public void add(String recordId, Date now, MsiServerRecordInfo.Node node, String message) {
        this.add(recordId, now, node, message,null);
    }

    @Override
    public void add(String recordId, Date now, MsiServerRecordInfo.Node node, String message, String dataTxt) {
        MsiServerRecordInfo recordInfo = new MsiServerRecordInfo();
        recordInfo.setRecordId(recordId);
        recordInfo.setCreateTime(now);
        //recordInfo.setNode(node.getNode());
        recordInfo.setNodeName(node.getNodeName());
        recordInfo.setMessage(message);
        recordInfo.setDataText(dataTxt);
        this.save(recordInfo);
    }

    @Override
    public void add(String recordId, Date now, MsiServerRecordInfo.Node node) {
        this.add(recordId, now, node, null);
    }
}
